#pragma once

#include "Notifier.h"
#include "ThreadTask.h"

using namespace TSE3;
/**
 *	
 * Changed History
 * 24 Sep 2009 - Jake Lin
 * 1. Change the SensorTester Menu. Delete the unused menu itmes.
 * 2. Add a Scale method to GVector.
 * 
 * 12 Set 2009 - Jake Lin
 * 1.Change SamsungGSensor to load SamsungMobilesdk_1.dll dynamically.
 *	
 * Copyright @ Jake Lin 2009 
 * 
 */



/**
 *  Accelerometer vector data.
 *
 */
typedef struct 
{
	float x;
	float y;
	float z;

	void Scale(float scale)
	{
		x *= scale;
		y *= scale;
		z *= scale;
	}
} GVector;

class IGSensor;
/**
 *  Oberver interface for Gravitation Sensor.
 *
 */
class IGSensorListener
{
public:
	typedef IGSensor notifier_type;

	virtual void IGSensor_GVectorChanged(IGSensor* gSensor, GVector gVector) {};
};

/**
 *  Interface of Gravitation Sensor.
 *
 */
class IGSensor : 
	public Notifier<IGSensorListener>,
	public ThreadTask
{
public:
	IGSensor(void);
	~IGSensor(void);

public:
	virtual GVector GetGVector() = 0;
	virtual void Register() = 0;
	virtual void Unregister() = 0;

protected:
	void GVectorChanged(GVector gVector);
};

class GSensorFactory
{
public:
	static IGSensor* CreateGSensor();
};